package by.airlanterns.service;

import by.airlanterns.dao.LanternDaoImpl;
import by.airlanterns.dto.Lantern;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by IntelliJ IDEA.
 * User: Sergey
 * Date: 27.01.13
 * Time: 14:41
 * To change this template use File | Settings | File Templates.
 */
@Service
public class LanternService {

    @Autowired
    private LanternDaoImpl lanternDao;

    public void saveOrUpdate(Lantern lantern) {
        lanternDao.saveOrUpdate(lantern);
    }

    public List<Lantern> getAllLanterns() {
        return lanternDao.findAll();
    }

    public Lantern getLanternById(int id) {
        return lanternDao.findById(id);
    }

    public List<Lantern> findByCategoryId(int id) {
        return lanternDao.findLanternsByCategoryId(id);
    }

    public void delete(Lantern lantern) {
        lanternDao.delete(lantern);
    }
    
    public Lantern findById(int id) {
        return lanternDao.findById(id);
    }


}
